package com.cx.postprocesser;

import lombok.ToString;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

/**
 * @Author:cxy
 * @Date:2022/2/9 21:45
 */
@ToString
@Component
public class MyOrderService implements InitializingBean {


    @Transactional(propagation = Propagation.REQUIRED)
    public void init(){
        System.out.println("===PostConstruct ==== ");
    }

    private Long id;

    private String remark;

    public MyOrderService() {
        System.out.println("#2 执行MyOrderService 无参构造器");
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        System.out.println("#3 执行MyOrderService setId");
        this.id = id;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        System.out.println("#4 执行MyOrderService setRemark");
        this.remark = remark;
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("#6 执行afterPropertiesSet");
        this.remark = "";

    }


}
